package com.jk.mapper;

import com.jk.model.*;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface WJSMapper {
    Integer findUserGe(HashMap<String, Object> params);

    List<UserBean> findUserList(HashMap<String, Object> params);

    @Insert("insert into t_user(userAccount,userPassword,userRole,userName,userImg) values(#{userAccount},#{userPassword},3,#{userName},#{userImg})")
    void register(UserBean userBean);

    @Select("select * from t_user where userAccount=#{userAccount}")
    UserBean queryUser(UserBean userBean);

    Integer findcount(HashMap<String, Object> params);

    List<UserBean> yimai(HashMap<String, Object> params);

    @Select("select * from t_product")
    List<ProductBean> shangpin();

    List<UserBean> daifukuan(HashMap<String, Object> params);

    List<UserBean> daifahuo(HashMap<String, Object> params);

    Integer find2(HashMap<String, Object> params);

    Integer find3(HashMap<String, Object> params);

    Integer dianpucount(HashMap<String, Object> params);

    List<UserBean> shangdian(HashMap<String, Object> params);

    @Select("select * from t_user_tree where pid = #{value}")
    List<MaiTree> findChildren(Integer id);

    Integer geshu(HashMap<String, Object> params);

    List<UserBean> findgeren(HashMap<String, Object> params);

    Integer dizigeshu(HashMap<String, Object> params);

    List<UserAcceptsite> dizi(HashMap<String, Object> params);

    @Select("update t_user set userPassword=#{password} where id=#{userId}")
    void updatePassword(@Param("password") String password,@Param("userId") Integer userId);

    @Select("select tp.* as createTime from t_product tp \n" +
            "      left join t_store b on tp.id = b.productId\n" +
            "   where tp.id = #{value}")
    ProductBean queryProductByProductId(Integer productId);

    @Insert("insert into t_store(storeName,storeImg,storeCreateTime,storeType) values(#{storeName},#{storeImg},now(),1)")
    int saveStore(StoreBean storeBean);
    @Select("select t.storeId from t_user t where t.id = #{value}")
    UserBean queryUserInfoById(Integer id);
    @Select("select ts.id from t_store ts where ts.storeName = #{value}")
    StoreBean findStoreName(String storeName);
    @Insert("update t_user tu set tu.storeId = #{id1} where tu.id = #{id}")
    void saveUserStoreId(@Param("id") Integer id,@Param("id1") Integer id1);

    @Update("update t_user set userName = #{userName},userAge = #{userAge},userAccount = #{userAccount},userImg = #{userImg} where id = #{id}")
    void updateuser(UserBean userBean);

    @Select("select * from t_user where id = #{value}")
    UserBean findUser(Integer id);

    @Insert("insert into t_user(userName,userSex,userAge,userAccount,userImg) values(#{userName},1,#{userAge},#{userAccount},#{userImg})")
    void saveUser(UserBean userBean);

    int findOrderCount(HashMap<String, Object> param);

    List<OrderBean> findOrderList(HashMap<String, Object> param);

    @Select("select tp.* as createTime from t_product tp  where tp.id = #{value}")
    ProductBean queryProductId(Integer productId);

    int queryOrderCount(HashMap<String, Object> param);

    List<OrderBean> queryOrderList(HashMap<String, Object> param);

    int pingjiafindOrderCount(HashMap<String, Object> param);

    List<OrderBean> pingjiafindOrderList(HashMap<String, Object> param);

    @Update("update t_order set orderStatus = 4 where productId = #{value} ")
    void updatetai(Integer productId);

}
